package com.lh0811.forge.pserv.uacs.server.component.data_scope.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
@AllArgsConstructor
public enum RuleLogicEnum {
    //    1-等于 2-不等于 3-大于 4-小于 5-大于等于 6-小于等于 7-包含 8-不包含 9-在列表中 10-不在列表中
    eq("1", "等于", "= ${} "),
    neq("2", "不等于", "!= ${} "),
    gt("3", "大于", "> ${} "),
    lt("4", "小于", "< ${} "),
    ge("5", "大于等于", ">= ${} "),
    le("6", "小于等于", "<= ${} "),
    contain("7", "包含", "like ${} "),
    not_contain("8", "不包含", "not like ${} "),
    in_list("9", "在列表中 ", "in ${} "),
    not_in_list("10", "不在列表中", "not in ${} ");

    private String code;
    private String msg;
    private String logicStr;

    public static RuleLogicEnum getByCode(String code) {
        for (RuleLogicEnum value : values()) {
            if (StringUtils.equals(value.getCode(), value.getCode())) {
                return value;
            }
        }
        return null;
    }
}
